package com.jike.shop.cloud.service;

import com.jike.shop.cloud.IOrderService;
import com.jike.shop.common.dto.CreateOrderDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class OrderServiceImpl implements OrderService {

    @DubboReference(group = "jike-shop",version = "1.0.0",protocol ="dubbo", check = false, cluster = "failfast", retries = 3, loadbalance = "roundrobin", actives = 10, timeout = 50000)
    private IOrderService orderService;

    @Override
    public long preCreateOrder() {
        return orderService.preCreateOrder();
    }

    @Override
    public String createOrder(CreateOrderDTO requestDTO) {
        boolean succ = orderService.createOrder(requestDTO);
        if(!succ){
            return "订单提交异常" + requestDTO.getOrderId();
        }
        return "提交成功";
    }

    @Override
    public void payOrder() {

    }
}
